package ad.android.model;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import ad.android.util.Constants;

/**
 * TblApplication entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "tbl_application", catalog = Constants.CATALOG)
public class Application implements java.io.Serializable {

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = -7504891365000522276L;
	private Long id;
	private AppType tblApptype;
	private Developer tblDeveloper;
	private String appName;
	private String appDescribe;
	/** license key */
	private String licenseKey;
	private String secKey;
	private Integer adRefreshTime;
	private Set<AdApplicationStatistics> tblAdApplicationStatisticses = new HashSet<AdApplicationStatistics>(
			0);
	
	/**
	 * 关键字
	 */
	private String keywords;
	/**
	 * 应用平台
	 */
	private String appPlatform; 
	/**
	 * 是否收费
	 */
	private Integer isFare;
	/**
	 * 版本
	 */
	private String version;
	/**
	 * 支持语言
	 */
	private String supLang;
	/**
	 * 用户群体(男女)
	 */
	private String supportSex;
	/**
	 * 用户群体(年龄阶段)
	 */
	private String supportAge;
	
	// Constructors

	/** default constructor */
	public Application() {
	}

	/** minimal constructor */
	public Application(AppType tblApptype, Developer tblDeveloper) {
		this.tblApptype = tblApptype;
		this.tblDeveloper = tblDeveloper;
	}

	public Application(AppType tblApptype, Developer tblDeveloper,
			String appName, String appDescribe, String licenseKey,
			String secKey, Integer adRefreshTime,
			Set<AdApplicationStatistics> tblAdApplicationStatisticses) {
		super();
		this.tblApptype = tblApptype;
		this.tblDeveloper = tblDeveloper;
		this.appName = appName;
		this.appDescribe = appDescribe;
		this.licenseKey = licenseKey;
		this.secKey = secKey;
		this.adRefreshTime = adRefreshTime;
		this.tblAdApplicationStatisticses = tblAdApplicationStatisticses;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	@Column(name = "ID", unique = true, nullable = true)
	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.EAGER) 
	@JoinColumn(name = "APPTYPE_ID", nullable = false)
	public AppType getTblApptype() {
		return this.tblApptype;
	}

	public void setTblApptype(AppType tblApptype) {
		this.tblApptype = tblApptype;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "DEVELOPER_ID", nullable = false)
	public Developer getTblDeveloper() {
		return this.tblDeveloper;
	}

	public void setTblDeveloper(Developer tblDeveloper) {
		this.tblDeveloper = tblDeveloper;
	}

	@Column(name = "APP_NAME", length = 100)
	public String getAppName() {
		return this.appName;
	}

	public void setAppName(String appName) {
		this.appName = appName;
	}

	@Column(name = "APP_DESCRIBE", length = 500)
	public String getAppDescribe() {
		return this.appDescribe;
	}

	public void setAppDescribe(String appDescribe) {
		this.appDescribe = appDescribe;
	}
	
	@Column(name = "LICENSE_KEY", length = 256)
	public String getLicenseKey() {
		return licenseKey;
	}

	public void setLicenseKey(String licenseKey) {
		this.licenseKey = licenseKey;
	}

	
	@Column(name = "SEC_KEY", length = 128)
	public String getSecKey() {
		return this.secKey;
	}

	public void setSecKey(String secKey) {
		this.secKey = secKey;
	}

	@Column(name = "AD_REFRESH_TIME")
	public Integer getAdRefreshTime() {
		return this.adRefreshTime;
	}

	public void setAdRefreshTime(Integer adRefreshTime) {
		this.adRefreshTime = adRefreshTime;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "tblApplication")
	public Set<AdApplicationStatistics> getTblAdApplicationStatisticses() {
		return this.tblAdApplicationStatisticses;
	}

	public void setTblAdApplicationStatisticses(
			Set<AdApplicationStatistics> tblAdApplicationStatisticses) {
		this.tblAdApplicationStatisticses = tblAdApplicationStatisticses;
	}
	@Column(name = "APP_PLATFORM", length = 500)
	public String getAppPlatform() {
		return appPlatform;
	}

	public void setAppPlatform(String appPlatform) {
		this.appPlatform = appPlatform;
	}
	@Column(name = "APP_ISFARE", length = 11)
	public Integer getIsFare() {
		return isFare;
	}

	public void setIsFare(Integer isFare) {
		this.isFare = isFare;
	}
	@Column(name = "APP_KEYWORDS", length = 200)
	public String getKeywords() {
		return keywords;
	}

	public void setKeywords(String keywords) {
		this.keywords = keywords;
	}
	@Column(name = "APP_SUPPORT_LANG", length = 200)
	public String getSupLang() {
		return supLang;
	}

	public void setSupLang(String supLang) {
		this.supLang = supLang;
	}
	@Column(name = "APP_SUPPORT_AGE", length = 200)
	public String getSupportAge() {
		return supportAge;
	}

	public void setSupportAge(String supportAge) {
		this.supportAge = supportAge;
	}
	@Column(name = "APP_SUPPORT_SEX", length = 200)
	public String getSupportSex() {
		return supportSex;
	}

	public void setSupportSex(String supportSex) {
		this.supportSex = supportSex;
	}
	@Column(name = "APP_VERSION", length = 200)
	public String getVersion() {
		return version;
	}

	public void setVersion(String version) {
		this.version = version;
	}

	
}